package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.AppointmentConfigDao;
import io.renren.dto.AppointmentConfigDTO;
import io.renren.entity.AppointmentConfigEntity;
import io.renren.service.AppointmentConfigService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 预约配置
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class AppointmentConfigServiceImpl extends CrudServiceImpl<AppointmentConfigDao, AppointmentConfigEntity, AppointmentConfigDTO> implements AppointmentConfigService {

    @Override
    public QueryWrapper<AppointmentConfigEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<AppointmentConfigEntity> wrapper = new QueryWrapper<>();

        String startDateTime = (String)params.get("startDateTime");
        String endDateTime = (String)params.get("endDateTime");
        wrapper.ge(StringUtils.isNotBlank(startDateTime), "start_time", startDateTime);
        wrapper.le(StringUtils.isNotBlank(endDateTime), "end_time", endDateTime);
        String proType = (String)params.get("proType");
        wrapper.eq(StringUtils.isNotBlank(proType), "pro_type", proType);

        return wrapper;
    }


}